Computer programs are typically written in source code that must be translated into a native machine code so that the translated native machine code can be executed by a computer. For example, Java.TM. technology uses both compilation and interpretation. Compilation is a process of translating computer code from one language to another language, and storing the results of that translation for later execution on a computer. Many well-known programming languages such as C, Pascal, and Fortran are usually compiled straight from source code to native machine code (i.e., native instructions of a microprocessor). In contrast, the Java.TM. programming language is typically compiled into Java.TM. class files, which contain architecture-independent instructions for the well-known Java.TM. Virtual Machine (e.g., Sun Microsystems, Inc., provides a commercially available package called the Java.TM. Development Kit (JDK) 1.0.2 and 1.1).
An interpreter is a program which performs the actions as directed by the source code or intermediate code (e.g., Java.TM. bytecode), at run time. Thus, interpretation involves translating code from one language to another language except that the translation is directly executed instead of stored for later execution. Languages (or language families) such as Lisp and Basic are typically interpreted straight from source code to native machine code. In contrast, in standard Java.TM. implementations, the interpreter interprets from the Java.TM. class files. In particular, Java.TM. Virtual Machine instructions (e.g., Java.TM. bytecodes), which were compiled from source code, are interpreted by a Java.TM. interpreter. Thus, the compiled source code is converted on the fly into native machine code, which is then executed rather than stored.
Interpreting Java.TM. Virtual Machine instructions is common on existing implementations of the Java.TM. Virtual Machine, but is not required by either the Java.TM. Language Specification or the Java.TM. Virtual Machine Specification. A Java.TM. Virtual Machine implementation can also use Just-In-Time (JIT) compilation: translating Java.TM. source code into native machine code at run time on the local platform and then executing the translated (stored) native machine code. Further, another approach is to have hardware such as a microprocessor that directly implements the Java.TM. Virtual Machine instruction set so that the microprocessor executes Java.TM. bytecodes directly.